package com.patterns.adapter.ObjAdapter;

import java.util.Map;

/**
 * Created by Xiao Yiyun on 2017/6/2.
 * 适配器
 */
public class OuterUserInfo implements IUserInfo {

    //源目标对象
    private IOuterUserBaseInfo baseInfo = null;
    private IOuterHomeInfo homeInfo = null;
    private IOuterUserOfficeInfo officeInfo = null;

    //数据处理
    private Map baseMap = null;
    private Map homeMap = null;
    private Map officeMap = null;

    //构造函数传递对象
    public OuterUserInfo (IOuterUserBaseInfo baseInfo,
                          IOuterHomeInfo homeInfo,
                          IOuterUserOfficeInfo officeInfo) {
        this.baseInfo = baseInfo;
        this.homeInfo = homeInfo;
        this.officeInfo = officeInfo;
        //数据处理
        this.baseMap = this.baseInfo.getUserBaseInfo();
        this.homeMap = this.homeInfo.getUserHomeInfo();
        this.officeMap = this.officeInfo.getUserOfficeInfo();
    }
    public String getUserName() {
        String userName = (String)this.baseMap.get("userName");
        System.out.println(userName);
        return userName;
    }

    public String getHomeAddress() {
        String homeAddress = (String)this.homeMap.get("homeAdress");
        System.out.println(homeAddress);
        return homeAddress;
    }

    public String getMobileNumber() {
        String mobileNumber = (String)this.baseMap.get("mobileNumber");
        System.out.println(mobileNumber);
        return mobileNumber;
    }

    public String getOfficeTelNumber() {
        return null;
    }

    public String getJobPosition() {
        return null;
    }

    public String getHomeTelNuber() {
        return null;
    }
}
